﻿using MESBaseis.Domain.BaseEntities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MESBaseis.Domain.ZSH
{
    /// <summary>
    /// 工序管理表
    /// </summary>
    public class Process : BaseModel
    {
        /// <summary>
        /// 工序编号
        /// </summary>
        [Required]
        [StringLength(50)]
        public string ProcessNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序名称
        /// </summary>
        [Required]
        [StringLength(100)]
        public string ProcessName { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类ID
        /// </summary>
        public int ProcessCategoryId { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>
        [StringLength(100)]
        public string? Department { get; set; }

        /// <summary>
        /// 负责人
        /// </summary>
        [StringLength(50)]
        public string? ResponsiblePerson { get; set; }

        /// <summary>
        /// 状态 (启用/禁用)
        /// </summary>
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500)]
        public string? Remarks { get; set; }

        /// <summary>
        /// 附件原始文件名
        /// </summary>
        [StringLength(255)]
        public string? AttachmentFileName { get; set; }

        /// <summary>
        /// 附件文件路径
        /// </summary>
        [StringLength(500)]
        public string? AttachmentFilePath { get; set; }

        /// <summary>
        /// 附件文件大小（字节）
        /// </summary>
        public long? AttachmentFileSize { get; set; }

        /// <summary>
        /// 附件上传时间
        /// </summary>
        public DateTime? AttachmentUploadTime { get; set; }

        // 导航属性
        /// <summary>
        /// 工序分类
        /// </summary>
        [ForeignKey("ProcessCategoryId")]
        public virtual ProcessCategory ProcessCategory { get; set; } = null!;

        /// <summary>
        /// 该工序在工艺流程中的步骤集合
        /// </summary>
        public virtual ICollection<ProcessFlowStep> ProcessFlowSteps { get; set; } = new List<ProcessFlowStep>();
    }
}
